﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataLib.Common;
using System.Data;
using Microsoft.Reporting.WebForms;
using Ewts.Code;

namespace Ewts.RDLC
{
    public partial class TempStorageSltRDLC : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string time1 = txtTime1.Text;
            string time2 = txtTime2.Text;
            if ((!PageValidate.IsDateTime(time1) && PageValidate.IsDateTime(time2)) || ((PageValidate.IsDateTime(time1) && !PageValidate.IsDateTime(time2))))
            {
                MessageBox.Show(this, "日期格式不合法，时间段填写完整！");
                return;
            }
            this.TempInStorageReportView.Visible = true;
            Search();
            
        }

        protected void Search()
        {
            string boxid = txtBoxid.Text;
            string cjo = txtCJO.Text;
            string classify = txtClassify.Text;
            string customer = txtcum.Text;
            string gcode = txtgCode.Text;
            string instorageno = txtInstorageno.Text;
            string loadnum = txtLoadnum.Text;
            string mark = txtMark.Text;
            string oper = txtOper.Text;
            string plateno = txtplateno.Text;
            string time1 = txtTime1.Text;
            string time2 = txtTime2.Text;
            string islock = ddlIslock.SelectedValue;

            DataTable dt = new DataLib.BLL.InStorage().GETWRLItem(loadnum,cjo,customer,mark,oper,time1,time2,instorageno,gcode,boxid,classify,islock,plateno);

            ReportDataSource rds = new ReportDataSource("TempStorageSltDS", dt);
            TempInStorageReportView.LocalReport.DataSources.Clear();
            TempInStorageReportView.LocalReport.DataSources.Add(rds);
            new RDLCPrinter().FillRow(dt, 3, 15, 15);
            TempInStorageReportView.LocalReport.Refresh();
        }
    }
}